package utils

import (
	"hotstuffImpl/crypto"
	"hotstuffImpl/entity"
	"log"
)

type Message struct {
	MsgType    entity.MessageType
	ViewNumber int
	Replica    *entity.Replica
	QuorumSig  *crypto.QuorumSig
	PartialSig *crypto.PartialSig
}

func CreateMessage(msgType entity.MessageType, viewNumber int, replica *entity.Replica, qs *crypto.QuorumSig) *Message {
	ps, err := CreatePartialSig(msgType, viewNumber, replica)
	if err != nil {
		log.Fatal(err)
	}
	return &Message{
		MsgType:    msgType,
		ViewNumber: viewNumber,
		Replica:    replica,
		QuorumSig:  qs,
		PartialSig: ps,
	}
}

func CreatePartialSig(msgType entity.MessageType, viewNumber int, replica *entity.Replica) (*crypto.PartialSig, error) {
	panic("未实现")
}
